package com.lichongbing.lyoggl.mapper;

import com.lichongbing.lyoggl.model.Account;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Entity com.lichongbing.lyoggl.model.Account
 */
@Component
public interface AccountMapper extends BaseMapper<Account> {
    /**
     * 查询账单
     * @param userid
     * @return
     */
    @Select("select a.id,b.name as bank,b.card as idcard,b.date0,b.date1,a.money,a.money1,a.money2,a.money3,a.pay,a.pay1,a.mouth,a.duted,a.year from account a\n" +
            "left join bank b on b.id = a.bankid where a.uid = #{userid}")
    List<Account> findByUid(String userid);

    /**
     *
     * @param id
     * @param userid
     * @return
     */
    @Delete("delete from account where id = #{id} and uid = #{userid}")
    int deleteByUid(String id, String userid);
}




